import { 注册状态 } from "../../state";
import { mysql } from "../../core/db";
/**
 * 注册账号
 */
export default async function reg(data: 注册数据,Callback:注册回调){
    //先检测是否可以注册
    let sql = "SELECT * FROM `cs` WHERE `cs`= '" + 1 + "'"
    let 是否可注册 = await mysql.pool.query(sql)
    console.log("是否可以注册",是否可注册);
    

    if('user' in data ==false){
        Callback({zt:注册状态.获取用户名失败})
        return
    }
    if('password' in data == false){
        Callback({zt:注册状态.获取密码失败})
        return
    }
    if('email' in data == false){
        Callback({zt:注册状态.获取邮箱失败})
        return
    }
    if(data.user.length <6 || data.user.length>15){
        //Callback()
    }
}





//接口
interface 注册数据 {
    user: string,
    password: string,
    email: string,
  }
interface 注册回调{
    (结果:{zt:number}):void
}